package com.sjksy.demo.msmapper.ledger;

import com.sjksy.demo.domain.Branch;
import com.sjksy.demo.domain.CustomerInformation;
import com.sjksy.demo.domain.Ledger;
import com.sjksy.demo.domain.TravelRoute;
import com.sjksy.demo.dto.guide.GuideInfoDto;
import com.sjksy.demo.dto.ledger.*;
import com.sjksy.demo.vo.ledger.LedgerBranchStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerGuideStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerRouteStatisticVo;
import com.sjksy.demo.vo.ledger.LedgerVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public interface LedgerMsMapper {


    /**
     * ledger的插入dto转实体
     * @param ledgerInsertDto ledger的插入dto
     */
    Ledger insertDtoToLedger (LedgerInsertDto ledgerInsertDto);

    /**
     * 实体转dto，里面的导游name要自己set添加
     * @param ledger ledger原始对象
     * @param travelRoute 旅游路线对象
     * @param customerInformation 顾客信息对象
     * @param branch 分公司对象
     */
    @Mapping(target = "customerId",source = "ledger.customerId")
    @Mapping(target = "routeId",source = "ledger.routeId")
    @Mapping(target = "guideId",source = "ledger.guideId")
    @Mapping(target = "branchId",source = "ledger.branchId")
    @Mapping(target = "name",source = "customerInformation.name")
    @Mapping(target = "branchName",source = "branch.branchName")
    @Mapping(target = "emName",source = "guideInfoDto.name")
    LedgerDto ledgerToDto(Ledger ledger, TravelRoute travelRoute, CustomerInformation customerInformation, Branch branch, GuideInfoDto guideInfoDto);

    LedgerVo DtoLedgerToLedgerVo(LedgerDto ledgerToDto);

    List<LedgerBranchStatisticVo> DtoLedgerBranchStatisticToVo(List<LedgerBranchStatisticDto> ledgerBranchStatisticDto);
    List<LedgerGuideStatisticVo> DtoLedgerGuideStatisticToVo(List<LedgerGuideStatisticDto> ledgerGuideStatisticDto);
    List<LedgerRouteStatisticVo> DtoLedgerRouteStatisticToVo(List<LedgerRouteStatisticDto> ledgerRouteStatisticDto);
}
